<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/9/23
  Time: 14:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="<c:url value='/js/jquery-1.8.2.js'/>"></script>
</head>
<body>
    <center>
        <form action="<c:url value='/newsServlet'/>" method="post">
            <input type="hidden" name="method" value="addcomment"/>
            <input type="hidden" name="newsid" value="${newsid}"/>
        <table border="1" rules="all">
            <tr align="center" bgcolor="#7fffd4">
                <td colspan="100"><h1>增加评论</h1></td>
            </tr>
            <tr>
                <td>评论内容(*)</td>
                <td>
                    <textarea cols="20" rows="5" name="content"></textarea>
                </td>
            </tr>
            <tr>
                <td>
                    评论人
                </td>
                <td>
                    <input type="text" name="author"/>
                </td>
            </tr>
            <tr align="center">
                <td colspan="100">
                    <input type="button" value="提交" onclick="checkadd()">
                    <a href="<c:url value='/newsServlet?method=list'/>"><button type="button">返回</button></a>
                </td>
            </tr>
        </table>
        </form>
    </center>
</body>
<script>
    function checkadd() {
        var content = $("[name='content']").val();
        if(content==null||content==""){
            alert("评论内容不能为空");
        }else{
            document.forms[0].submit();
        }
    }
</script>
</html>
